﻿using System;
using System.Collections.Generic;
using System.Linq;
using NTTDATA.BEENChina.ResultCertification.Config;

namespace NTTDATA.BEENChina.ResultCertification.Checker.Select
{
    [Serializable]
    [VerfityAttribute(Id = "VerfityS0304", Name = "各工程选择项目对比检证", CategoryType = EnumCategoryType.选择, Model = true)]  
    public class VerfityS0304 : VerfityMulitResult
    {

        public override bool CheckResult(List<List<string>> result1, string entryCommon1, List<List<string>> result2, string entryCommon2)
        {
            var selectResult1 = GetSpecialResult(result1);
            var selectResult2 = GetSpecialResult(result2);

            return new Verfity0304().CheckResult(selectResult1, entryCommon1, selectResult2, entryCommon2);
        }

        /// <summary>
        /// 得到选择部分
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private List<List<string>> GetSpecialResult(List<List<string>> result)
        { 

            return result.Select(o => o.Select(colResult =>
                                                   {
                                                       var splitResult = new Split.SplitEntryResult(ChildImageObject.CategorySetting.DataFormat, colResult);
                                                       return splitResult.GetSelect();
                                                   }).ToList()).ToList();
        }
    }
}
